package com.simplehc7878.warning.strategy.impl;

import com.simplehc7878.warning.domain.model.WarningRule;
import com.simplehc7878.warning.enums.RuleType;
import com.simplehc7878.warning.strategy.WarningStrategy;
import org.springframework.context.ApplicationContext;

import java.util.LinkedList;
import java.util.List;

public class StrategyGroup {

    public static List<WarningStrategy> init(WarningRule warningRule, ApplicationContext context) {
        List<WarningStrategy> list = new LinkedList<>();
        RuleType ruleType = RuleType.getByValue(warningRule.getRuleType());
        if (RuleType.CON.equals(ruleType)) {
            list.add(context.getBean(DataMetricsWarningStrategy.class));
        }
        return list;
    }
}
